FIX: Don't try to generate Gargo.lock on empty workspaces.
authorJuan Hernández <juan.hernandez.babon@gmail.com>
Wed, 14 Sep 2016 19:02:47 +0000 (15:02 -0400)
committerJuan Hernández <juan.hernandez.babon@gmail.com>
Wed, 14 Sep 2016 19:02:47 +0000 (15:02 -0400)
commit015e79728c972036e125916cee76e6460da51493
tree8a64163a65f024410dfa3e693fc335dcb6ce936b
parent7f642f583bf71796d3137df19f0316468aba5fc0
FIX: Don't try to generate Gargo.lock on empty workspaces.

There was a panic! when the command `cargo update` was
executed in a workspace like this:

    mkdir ws
    cd ws
    echo '[workspace]' > Cargo.toml
    cargo new p1
    cargo new p2
    cargo update

The problem is that cargo tries to generate the Cargo.lock file
even if there aren't any members on the workspace.

This fix checks the existence of members in the workspace before trying
to do anything so at least we report an error instead of throwing a
panic!
src/cargo/core/workspace.rs
src/cargo/ops/cargo_generate_lockfile.rs
tests/workspaces.rs